#ifndef TCPSERVICE_H
#define TCPSERVICE_H

#include <string>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>

class TcpService {
public:
	TcpService();
	int createService(std::string ip, int maxconn);
	int createService(std::string ip, int port, int maxconn);
	int acceptConnection();
	void connectToService(std::string ip, int port);
	void closeService();
	ssize_t TcpSend(void *buf, size_t len);
	ssize_t TcpRecv(void *buf, size_t len);
private:
	int tcpSocket;
	struct sockaddr_in tcpAddr;
	static int randSeed;
	static socklen_t addr_len;
};

#endif
